package com.xyz.wll.es.manager.ui.frame;

import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;

public class AboutFrame extends JFrame {
    private JPanel mainPanel;
    private JLabel author;
    private JLabel company;
    private JLabel version;
    private JScrollPane changeLogPane;
    private JList<String> changeLog;

    public AboutFrame() {
        this.setTitle("版本信息");
        this.setResizable(false);

        mainPanel = new JPanel();
        this.setContentPane(mainPanel);
        mainPanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));

        author = new JLabel("作者 : 王黎亮");
        mainPanel.add(author,new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));

        company = new JLabel("公司 : wll-xyz.com");
        mainPanel.add(company,new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));

        version = new JLabel("版本 : 1.0.0");
        mainPanel.add(version, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));

        changeLogPane = new JScrollPane();
        mainPanel.add(changeLogPane, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));

        changeLog = new JList();
        DefaultListModel defaultListModel = new DefaultListModel();
        defaultListModel.addElement("1.0.0 : 基本功能版本");
        defaultListModel.addElement("1.1.0 : 添加数据复制粘贴功能");
        defaultListModel.addElement("1.2.0 : 添加数据导入导出功能");
        defaultListModel.addElement("1.3.0 : 添加添加索引创建和删除功能");
        defaultListModel.addElement("1.4.0 : 添加查询过滤功能");
        defaultListModel.addElement("1.5.0 : 添加表结构导入导出功能");
        defaultListModel.addElement("1.6.0 : 添加版本信息");
        defaultListModel.addElement("1.6.1 : 添加索引结构和数据复制，粘贴，备份功能操作界面");
        defaultListModel.addElement("1.6.2 : 修正增量导入数据问题和批量导入数据量过大问题");
        defaultListModel.addElement("1.7.0 : 添加索引结构和数据复制，粘贴，备份功能");
        defaultListModel.addElement("1.7.1 : 调整状态输出栏");
        changeLog.setModel(defaultListModel);
        changeLogPane.setViewportView(changeLog);

        version.setText("版本 : " + defaultListModel.getElementAt(defaultListModel.getSize()-1).toString().split(":")[0]);
    }
}
